/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* plusOne(int* digits, int digitsSize, int* returnSize)
{
    int* arr = (int*)calloc(200, sizeof(int));
    digits[digitsSize - 1]++;
    for (int i = digitsSize - 1; i >= 0; i--)
    {
        arr[i + 1] += digits[i];
        if (arr[i + 1] > 9)
        {
            arr[i + 1] %= 10;
            arr[i]++;
        }
    }
    if (arr[0] == 0)
    {
        *returnSize = digitsSize;
        return arr + 1;
    }
    else
    {
        *returnSize = digitsSize + 1;
        return arr;
    }
}